import {useSessionStorage} from "@vueuse/core";

// token存储
const TOKEN_STORAGE = useSessionStorage<string>("Authorization", "");

/**
 * 设置token
 * @param value 值
 */
export function setToken(value: string) {
  TOKEN_STORAGE.value = value;
}

/**
 * 获得token
 */
export function getToken(): string | undefined {
  return TOKEN_STORAGE.value || undefined;
}

/**
 * 清除token
 */
export function removeToken() {
  TOKEN_STORAGE.value = "";
}
